]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
telepathyClient: Fix auto-scroll to bottom
authorSjoerd Simons <sjoerd@luon.net>
Sun, 21 Oct 2012 12:11:45 +0000 (14:11 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 2 Nov 2012 11:06:52 +0000 (12:06 +0100)
Instead of keeping track of the old adjustment.upper keep track of the
old adjustment.value that corresponded to the bottom scroll position.

This fixes the integrated chatview not always scrolling to the bottom
by removing the assumption that page_size is constant between updates,
which is not the case as the view is presented in various different ways.

https://bugzilla.gnome.org/show_bug.cgi?id=686571

js/ui/components/telepathyClient.js

index a487352e4c6cfb3bde632fa6b6f82367f282c774..dc7da4d5ed410c9fb3fc8a7cab8028b805ab8789 100644 (file)
@@ -771,16 +771,18 @@ const ChatNotification = new Lang.Class({
             this.emit('unfocused');
         }));
 
-        this._oldMaxScrollAdjustment = 0;
         this._createScrollArea();
         this._lastGroup = null;
         this._lastGroupActor = null;
 
+        // Keep track of the bottom position for the current adjustment and
+        // force a scroll to the bottom if things change while we were at the
+        // bottom
+        this._oldMaxScrollValue = this._scrollArea.vscroll.adjustment.value;
         this._scrollArea.vscroll.adjustment.connect('changed', Lang.bind(this, function(adjustment) {
-            let currentValue = adjustment.value + adjustment.page_size;
-            if (currentValue == this._oldMaxScrollAdjustment)
+            if (adjustment.value == this._oldMaxScrollValue)
                 this.scrollTo(St.Side.BOTTOM);
-            this._oldMaxScrollAdjustment = adjustment.upper;
+            this._oldMaxScrollValue = Math.max(adjustment.lower, adjustment.upper - adjustment.page_size);
         }));
 
         this._inputHistory = new History.HistoryManager({ entry: this._responseEntry.clutter_text });